package cn.yunyichina.provider.hisiface.invoke.openservice;

import cn.yunyichina.provider.framework.dubbo.service.PayService;
import cn.yunyichina.provider.hisiface.invoke.IOutsideInvoke;
import cn.yunyichina.provider.iface.entity.common.ResCommon;
import cn.yunyichina.provider.iface.entity.pay.PaymentJournalResponseOut;
import cn.yunyichina.provider.iface.entity.pay.PaymentJournalVoOut;
import cn.yunyichina.utils.convert.JsonUtils;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.Map;

/**
 * 订单查询
 *
 * @author zhou
 * @date 2017年7月18日
 */
public class OrdersQueryService implements IOutsideInvoke {

	static Logger logger = LoggerFactory.getLogger(OrdersQueryService.class);
			
	@Override
	public String execute(Map<String, String> params) {
		String paramsStr = JSON.toJSONString(params);
		logger.info("openService:ordersQuery 接收到前置机的入参: {}", paramsStr);
		PaymentJournalVoOut infoVo = JsonUtils.parseObject(params, PaymentJournalVoOut.class);
		ResCommon<List<PaymentJournalResponseOut>> response = PayService.getPayClient().paymentJournalQuery(infoVo);
		String result = JsonUtils.toJsonString(response);
		logger.info("openService:ordersQuery 返回给前置机: {}", result);
		return result;
	}

}
